/*
TO DO:

*/

#ifndef LIBRARYMEMBER_H
#define LIBRARYMEMBER_H

#include <iostream>
#include <vector>
#include <string>
#include "Book.h"

class Book; // hogy ne dobhasson hibat, azert mert nem latja

class LibraryMember
{
    protected:
        int LibraryMemberID; // azonosito
        std::string Name; // nev
        std::string Address; // cim
        std::string Availability; // elerhetoseg
        unsigned int Interval; // kolcsonzesi idointervallum
        unsigned int Maximum; // maximum kolcsonozhato konyvek szama
        std::vector<Book*> LoansOfMember; // tag kolcsonzeseit tartalmazo vektor
        std::string TypeName; // tagsag tipusanak neve
        int TypeID; // tagsag tipusanak azonositoja
        static int NextID; // kovetkezo ID-t tarolo statikus adattag
    public:
        LibraryMember(const std::string& Name_init, const std::string& Address_init, const std::string& Availability_init) : Name(Name_init), Address(Address_init), Availability(Availability_init) // ctor
        {
            LibraryMemberID = NextID++;
        }
        virtual ~LibraryMember() {} // dtor

        void SetName(const std::string& Name);
        void SetAddress(const std::string& Address);
        void SetAvailability(const std::string& Availability);
        void SetTypeID(const int& TypeID);
        void SetTypeName(const std::string& TypeName);
        void SetLibraryMemberID(const int& LibraryMemberID);

        std::string GetName() const { return Name; }
        std::string GetAddress() const { return Address; }
        std::string GetAvailability() const { return Availability; }
        int GetTypeID() const { return TypeID; }
        std::string GetTypeName() const { return TypeName; }
        int GetLibraryMemberID() const { return LibraryMemberID; }
        int GetNumOfLoans() const { return LoansOfMember.size(); }
        //virtual int GetDeadline() const = 0;
        //virtual int GetDeadline() const;
        //int GetRemaining() const { return }

        void NewMember();
        void ModifyMember();
        void ModifyMember(int Funct, std::string& NewData);
        void SearchMember();
        void LendingsOfMembers();
        void DeleteMember();
        void ListMember();
        void MemberDetails();

        virtual bool Loan_LOAD(Book* mitmit);
        virtual bool Loan(Book* mitmit);
        int Return(const std::string& BookID);
        Book* FirstLoan() const { return LoansOfMember.front(); }
        bool CanLoan() { return LoansOfMember.size() <= Maximum; }

        friend std::ostream& operator<<(std::ostream&, const LibraryMember*);
        enum Exception {INVALID_RETURN,INVALID_LOAN};
};

#endif // LIBRARYMEMBER_H
